function myNew (Constructor,...rest) {
    const newObj = Object.create(Constructor.prototype)
    const res = Constructor.apply(newObj,[...rest])
    return typeof res === 'object' ? res : newObj
}


function test(name,age) {
    this.name = name
    this.age = age
    return {nowYear:age}
}
test.prototype.sex = 'boy'

const person = myNew(test,'nlx','24')
console.log(person);